/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.wdm.utils;

import com.google.gson.*;
import java.lang.reflect.Type;
import org.wdm.beans.points.BusStopPoint;

/**
 *
 * @author thanasis
 */
public class BusStopPointDeserializer implements JsonDeserializer<BusStopPoint>
{
  @Override
  public BusStopPoint deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context)
      throws JsonParseException
  {
      JsonObject job = json.getAsJsonObject();
      int busStopPointId = job.get("busStopPointId").getAsInt();
      String naptanAtco = job.get("naptanAtco").getAsString();
      String name = job.get("name").getAsString();
      String busRoute = job.get("busRoute").getAsString();
      double latitude = job.get("latitude").getAsDouble();
      double longitude = job.get("longitude").getAsDouble();
      String pointType = job.get("pointType").getAsString();
    
    return new BusStopPoint(naptanAtco, name, busRoute, latitude, longitude);
  }
}  

